package com.butterfly.hotkey.client.core.collector.segment;

import com.butterfly.hotkey.core.constant.NumConst;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author butterfly
 * @since 2024/11/1
 */
public abstract class AbstractSegment<K, V> implements ISegment<K, V> {

    /**
     * segment
     * key - key
     * value - key的汇集数据
     */
    protected Map<String, V> segment;

    public AbstractSegment() {
        this.segment = new ConcurrentHashMap<>(NumConst.SIXTY_FOUR);
    }

    @Override
    public void clear() {
        this.segment.clear();
    }

    @Override
    public Map<String, V> getSegment() {
        return segment;
    }
}
